package com.hopu.blb_erp.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hopu.blb_erp.entity.MoveWarehouse;
import com.hopu.blb_erp.entity.Order;
import com.hopu.blb_erp.entity.PageEntity;
import com.hopu.blb_erp.entity.TCargo;
import com.hopu.blb_erp.service.CargoService;
import com.hopu.blb_erp.service.MoveWarehouseService;
import com.hopu.blb_erp.service.OrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.sql.Timestamp;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

@Api
@RestController
public class MoveWarehouseController {

    @Autowired
    private MoveWarehouseService moveWarehouseService;

    @ApiOperation("分页查询移库单表")
    @GetMapping("/moveWarehouse/{current}/{pageSize}")
    public ResponseEntity<PageEntity<MoveWarehouse>> findPage(@PathVariable("current")Integer current, @PathVariable("pageSize")Integer pageSize){
        PageEntity<MoveWarehouse> page = moveWarehouseService.findPage(current, pageSize);
        return ResponseEntity.ok(page);
    }

    @ApiOperation("添加移库单信息")
    @PostMapping("/moveWarehouse")
    public ResponseEntity<String> add(@RequestBody MoveWarehouse moveWarehouse){
        // 将移库单信息添加到表中
        moveWarehouseService.save(moveWarehouse);
        return ResponseEntity.ok("ok");
    }
}
